import os
import time
import subprocess
import shutil

'''
 Delete a file
'''
def remove_file(file):
	if os.path.isfile(file):
		print("Deleting: " + file)
		os.remove(file)

'''
 Remove a dir
'''
def remove_dir(dir):
	if os.path.isdir(dir):
		print("Deleting: " + dir)
		shutil.rmtree(dir)

'''
 Call an app
'''
def invoke_app(app, sleep_interval = 3*60):
    print("->" + app)
    os.startfile(app)
    print("Now sleep " + str(sleep_interval) + " seconds")
    time.sleep(sleep_interval)

'''
 Yet another way to call an app
'''
def invoke_app2(app, sleep_interval = 3*60):
    print("->" + app)
    os.system(app)
    print("Now sleep " + str(sleep_interval) + " seconds")
    time.sleep(sleep_interval)

'''
 Startup for home settings
'''
def startup_home():
	print("Call startup for home settings...")
	invoke_app2(r'start "" "C:\Documents and Settings\wcharry\Local Settings\Application Data\Google\Chrome\Application\chrome.exe" "--enable-sync""', 3);
	invoke_app("C:\Program Files\Windows Live\Mesh\WLSync.exe");
	invoke_app("C:\Home\Apps\Misc\ATnotes\ATnotes.exe")
	invoke_app("C:\Home\Apps\Misc\caffeine.exe");
	invoke_app("C:\Program Files\Tiny Utilities\Vitrite\Vitrite.exe");
	
'''
 Startup for office settings
'''
def startup_office():
	print("Call startup for office settings...")
	invoke_app2(r'start "" "C:\Documents and Settings\wcharry\Local Settings\Application Data\Google\Chrome\Application\chrome.exe" "--enable-sync""', 3);
	invoke_app("C:\Program Files\Microsoft Office\Office14\OUTLOOK.exe")
	invoke_app("C:\Program Files\Microsoft Office Communicator\Communicator.exe")
	invoke_app("C:\Home\Apps\Misc\ATnotes\ATnotes.exe")
	invoke_app("C:\Program Files\Tiny Utilities\Vitrite\Vitrite.exe");
    #invoke_app(r"C:\Charry\Apps\Network\PuTTY\backup.cmd");
    
'''
 Load home profile
'''
def load_home_profile():
    print("You're logged in at home")
    #os.system("regedit /s ie_home.reg")
    
    startup_home()
    
'''
 Load office profile
'''
def load_office_profile():
    print("You're logged in at office")
    #os.system("regedit /s ie_office.reg")
    
    startup_office()
